
//-------------------------
// Legislators as Lobbyists
// TABLE A7
//-------------------------

* House

clear
use masterdata_house.dta

// generate demographic variables

gen senior = (pop65to74 + pop75to84 + popover85)/population
gen whiteratio = white/population
gen blackratio = black/population
gen a1 = white/population
gen a2 = black/population
gen a3 = native/population 
gen a4 = asian/population
gen a5 = pacific/population
gen a6 = otherrace/population 
gen a7 = twomorerace/population
gen ethnic = 1 - (a1^2 + a2^2 + a3^2 + a4^2 + a5^2 + a6^2 + a7^2)
gen nohs = lessthanhs/pop_over25
gen hs = highschool/pop_over25 
gen loweredu = nohs + hs
gen college = bachelor/pop_over25
gen advanced = (master + professional + doctoral)/pop_over25
gen unemployment = pop_unemployed/pop_civilian


gen housecom =.
replace housecom = 1 if primary_committee == "Education and Labor"
replace housecom = 1 if primary_committee == "Education and Workforce"
replace housecom = 1 if primary_committee == "Education and the Workforce"
replace housecom = 0 if housecom ==. & house ==1

gen housecom2 =.
replace housecom2 = 1 if committee1 == "Education and Labor" 
replace housecom2 = 1 if committee2 == "Education and Labor" 
replace housecom2 = 1 if committee3 == "Education and Labor" 
replace housecom2 = 1 if committee4 == "Education and Labor"
replace housecom2 = 1 if committee1 == "Education and Workforce" 
replace housecom2 = 1 if committee2 == "Education and Workforce" 
replace housecom2 = 1 if committee3 == "Education and Workforce" 
replace housecom2 = 1 if committee4 == "Education and Workforce"
replace housecom2 = 1 if committee1 == "Education and the Workforce" 
replace housecom2 = 1 if committee2 == "Education and the Workforce" 
replace housecom2 = 1 if committee3 == "Education and the Workforce"
replace housecom2 = 1 if committee4 == "Education and the Workforce"
replace housecom2 = 0 if housecom2 ==. & house ==1

gen houtradecom = .
replace houtradecom = 1 if committee1 =="Ways and Means"
replace houtradecom = 1 if committee2 =="Ways and Means"
replace houtradecom = 1 if committee3 =="Ways and Means"
replace houtradecom = 1 if committee4 =="Ways and Means"
replace houtradecom = 0 if houtradecom == . & house ==1


replace medianincome = ln(medianincome+1)
replace publicunion = publicunion/100

macro define member_char "contact democrat vote_share committee_chair housecom2 leadership trade_idealpoint1"
macro define district_char "senior whiteratio loweredu gini medianincome unemployment presdem_2008 change_china_exp l_manu_emp publicunion"


// summary statistics 
tabstat $member_char $district_char, stat(N mean sd min max) col(stat)




* Senate

clear
use masterdata_senate.dta

gen sencom = .
replace sencom = 1 if primary_committee == "Health, Education, Labor, and Pensions"
replace sencom = 0 if sencom == . & house == 0

gen sencom2 = .
replace sencom2 = 1 if committee1 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee2 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee3 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee4 == "Health, Education, Labor, and Pensions"
replace sencom2 = 0 if sencom2 == . & house == 0

gen sentradecom =.
replace sentradecom = 1 if committee1 == "Finance"
replace sentradecom = 1 if committee2 == "Finance"
replace sentradecom = 1 if committee3 == "Finance"
replace sentradecom = 1 if committee4 == "Finance"
replace sentradecom = 0 if sentradecom == . & house == 0


// generate demographic variables

gen senior = (pop65to74 + pop75to84 + popover85)/population
gen whiteratio = white/population
gen blackratio = black/population
gen a1 = white/population
gen a2 = black/population
gen a3 = native/population 
gen a4 = asian/population
gen a5 = pacific/population
gen a6 = otherrace/population 
gen a7 = twomorerace/population
gen ethnic = 1 - (a1^2 + a2^2 + a3^2 + a4^2 + a5^2 + a6^2 + a7^2)
gen nohs = lessthanhs/pop_over25
gen hs = highschool/pop_over25 
gen loweredu = nohs + hs
gen college = bachelor/pop_over25
gen advanced = (master + professional + doctoral)/pop_over25
gen unemployment = pop_unemployed/pop_civilian

replace committee_chair = 0 if committee_chair ==.
replace medianincome = ln(medianincome+1)
replace pubunionmember = pubunionmember/100

macro define member_char "contact democrat vote_share committee_chair sencom2 leadership trade_idealpoint1"
macro define district_char "senior whiteratio loweredu gini medianincome unemployment state_presdem2008 change_china_exp l_manu_emp pubunionmember"


// summary statistics 
tabstat $member_char $district_char, stat(N mean sd min max) col(stat)

